package com.example.edu.school;

import com.example.edu.school.user.Visitable;
import com.example.edu.school.user.impl.Student;
import com.example.edu.school.user.impl.Teacher;
import com.example.edu.school.visitor.Visitor;

import java.util.ArrayList;
import java.util.List;

public class DataHolder {
    private List<Visitable> users = new ArrayList<>();


    public DataHolder() {
        users.add(new Student("郭德纲", "文科", "公安局局长"));
        users.add(new Student("于谦", "文科", "教育局局长"));
        users.add(new Student("诸葛钢铁", "理科", "诸葛孔明后人"));
        users.add(new Student("阿毛", "文科", "无背景"));
        users.add(new Teacher("皮蛋", "博士后"));
        users.add(new Teacher("黑妞", "博士后"));
        users.add(new Teacher("宝宝", "博士后"));
    }

    public void accept(Visitor visitor) {
        for (Visitable user : users) {
            user.accept(visitor);
        }
    }
}
